//
//  UIBarButtonItem+Extention.swift
//  TTWeibo
//
//  Created by 唐磊guang on 16/7/3.
//  Copyright © 2016年 唐磊guang. All rights reserved.
//

import UIKit

extension UIBarButtonItem {
    class func creatBarButtonItem(imageName: String , taget: AnyObject? , action: Selector) -> UIBarButtonItem{
        let btnadiaozhatianaaaaaaa = UIButton()
        btnadiaozhatianaaaaaaa.setBackgroundImage(UIImage(named:imageName), forState: UIControlState.Normal)
        btnadiaozhatianaaaaaaa.setBackgroundImage(UIImage(named:imageName + "_highlighted"), forState: UIControlState.Highlighted);
        btnadiaozhatianaaaaaaa .addTarget(taget, action: action, forControlEvents: UIControlEvents.TouchUpInside)
        btnadiaozhatianaaaaaaa.sizeToFit()
        let barButton = UIBarButtonItem(customView: btnadiaozhatianaaaaaaa)
        return barButton
    }
}
